package za.ac.sun.cs.viz.distrib;

import java.awt.FontMetrics;

import javax.swing.JComponent;

public class VizNode {

	private final String text;
	private final int activity;
	private final int id;
	private int width = 40;
	private int height = 20;

	public VizNode(String text, int activity, int id) {
		this.text = text;
		this.activity = activity;
		this.id = id;
	}

	public String getText() {
		return text;
	}

	public int getActivity() {
		return activity;
	}

	public int getID() {
		return id;
	}
	
	public void setHW(JComponent context) {
		FontMetrics m = context.getFontMetrics(context.getFont());
		width = m.stringWidth(getText()) + 10;
		height = m.getHeight() + 10;
	}

	public int getWidth(JComponent context) {
		return width;
	}
	
	public int getHeight(JComponent context) {
		return height;
	}
	
}
